package org.nepu.scr.indexrate.converter.compliancerate.operationreliability;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.compliancerate.operationreliability.PowerA114;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class PowerA114Converter implements AttributeConverter<PowerA114, String> {
    @Override
    public String convertToDatabaseColumn(PowerA114 powerA114) {
        return JSONUtil.toJsonStr(powerA114);
    }

    @Override
    public PowerA114 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, PowerA114.class);
    }
}
